home *** CD-ROM | disk | FTP | other *** search
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- %
- % underspc.sty 24-June-89
- %
- % Jonathan Kew (...!texbell!txsil!jon)
- %
- % LaTeX style option to allow underlining of inter-word spaces.
- %
- % This style file creates a ``magicspaces'' environment, within
- % which all inter-word spaces are filled with \xleaders\underbox
- % instead of plain glue. All normal word and sentence spacing
- % rules still work (I think). Within ``magicspaces'', a blank
- % line does *not* generate a paragraph break, just a normal
- % word space.
- % NOTE: spaces generated by macros which were defined outside
- % the environment will *not* be dealt with.
- % The \underbox specified here isn't what I really use: I have
- % a special character in my underlined fonts.
- %
- %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- % Excuse the lack of comments. If you want this, you can probably
- % figure out how it works! (The TeXbook explains all, of course.)
- \def\@eat#1{\futurelet\n@xt\@@eat}
- \def\@@eat{{\ifx\n@xt\@spc\aftergroup\@eat\fi}}
- \def\@spc{\@ulspc\futurelet\n@xt\@@eat}
- \def\@ulspc{\ifnum\spacefactor=\@m \@@ulspc\else
- \@spcwid\fontdimen2\font
- \ifnum\spacefactor>1999 \advance\@spcwid\fontdimen7\font\fi
- \@spcstretch\fontdimen3\font
- \multiply\@spcstretch\spacefactor \divide\@spcstretch\@m
- \@spcshrink\fontdimen4\font
- \multiply\@spcshrink\@m \divide\@spcshrink\spacefactor
- \xleaders\copy\underbox\hskip\@spcwid plus\@spcstretch minus\@spcshrink\fi}
- \newdimen\@spcwid \newdimen\@spcstretch \newdimen\@spcshrink
- \newbox\underbox
- \setbox\underbox=\hbox{\hskip-.05pt
- \vrule width.5pt height-.8pt depth1pt\hskip-.05pt}
- \def\@@ulspc{\xleaders\copy\underbox\hskip\fontdimen2\font
- plus\fontdimen3\font minus\fontdimen4\font\futurelet\n@xt\@@eat}
- \let\@space\ % remember the real control-space
- \def\magicspaces{\catcode`\ \active\catcode`\^^M\active%
- \def~{\penalty\@M\@spc}\let\ \@@ulspc\futurelet\n@xt\@@eat}
- \def\endmagicspaces{\ifhmode\unskip\fi% beware of this---it could bite back
- \catcode`\ 10 \catcode`\^^M5
- \def~{\penalty\@M\space}\let\ \@space}
- {\magicspaces\global\let \@spc\global\let^^M\@spc}
- % End of underspc.sty
-